package com.roadmap.entities;

import java.util.Date;

import com.roadmap.common.BaseConst;
import com.roadmap.common.BaseEntity;
import com.roadmap.struts.action.ActionConst;

/**
 * this class describes aspirants. the registerredTime refers to createdTime
 * defined in BaseObject and lastLoginTime refers to updatedTime
 */
public class Aspirant extends BaseEntity {
	private String mail;
	private String realName;
	private String loginPassword; // the password stored in database is encrypted
	private char sex;
	private Date birthday;
	private int loveType;
	private String imagePath;
	private String country;
	private String city;
	private String province;
	private String loginIP;

	public Aspirant() {
		super();
		this.loveType = BaseConst.ASPIRANT_LOVETYPE_NoMate;
		this.sex = BaseConst.ASPIRANT_SEX_MALE;
	}

	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getLoginPassword() {
		return loginPassword;
	}

	public void setLoginPassword(String password) {
		this.loginPassword = password;
	}

	public char getSex() {
		return sex;
	}

	public void setSex(char sex) {
		this.sex = sex;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public int getLoveType() {
		return loveType;
	}

	public void setLoveType(int loveType) {
		this.loveType = loveType;
	}

	public String getImagePath() {
		return imagePath;
	}

	public void setImagePath(String imagePath) {
		this.imagePath = imagePath;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getLoginIP() {
		return loginIP;
	}

	public void setLoginIP(String loginIP) {
		this.loginIP = loginIP;
	}

	@Override
	public String getWhatItIs() {
		String name = this.getRealName();
		if (name != null && name.length() > DESP_MAX_LENGTH) {
			name = name.split(" ")[0];
			if (name.length() > ActionConst.Displayed_Name_Max_Length) {
				name = name.substring(0, ActionConst.Displayed_Name_Max_Length);
			}
		}
		return name;
	}
	
}
